﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sinacor.OMM.HealthMonitor.Entity.Common;

namespace Sinacor.OMM.HealthMonitor.Entity.Receiver
{
    [Serializable()]
    public class ReceiverData : HealthEntityBase, IHealthDataReset
    {
        
        public ReceiverData()
            : base(HealthType.Receiver)
        {
            _stmConnection = new STMConnection(this);
            _statistic = new Statistic(this);
            _msmqConnection = new MSMQConnection(this);
            _processData = new ProcessData(this);
            _errorData = new ErrorData(this);
        }

        STMConnection _stmConnection;
        public STMConnection StmConnectionInfo
        {
            get { return _stmConnection; }
            set 
            { 
                _stmConnection = value;
                this.LastUpdate = DateTime.Now;
            }
        }

        Statistic _statistic;
        public Statistic StatisticInfo
        {
            get { return _statistic; }
            set 
            { 
                _statistic = value;
                this.LastUpdate = DateTime.Now;
            }
        }

        MSMQConnection _msmqConnection;
        public MSMQConnection MsmqConnectionInfo
        {
            get { return _msmqConnection; }
            set 
            { 
                _msmqConnection = value;
                this.LastUpdate = DateTime.Now;
            }
        }

        ProcessData _processData;
        public ProcessData ProcessDataInfo
        {
            get { return _processData; }
            set 
            { 
                _processData = value;
                this.LastUpdate = DateTime.Now;
            }
        }

        private ErrorData _errorData;

        public ErrorData ErrorData
        {
            get { return _errorData; }
            set
            {
                _errorData = value;
                this.LastUpdate = DateTime.Now;
            }
        }

        public void Reset()
        {
            ErrorData.Reset();
            StmConnectionInfo.Reset();
            StatisticInfo.Reset();
            MsmqConnectionInfo.Reset();
            ProcessDataInfo.Reset();
        }
    }
}
